using HKB.Common;
using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Diagnostics;
namespace HKB.Data.Dal.H_GroupTableAdapters
{
	[GeneratedCode("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"), DataObject(true), HelpKeyword("vs.data.TableAdapter"), Designer("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), DesignerCategory("code"), ToolboxItem(true)]
	public class HL_GroupTableAdapter : Component
	{
		private SqlDataAdapter _adapter;
		private SqlConnection _connection;
		private SqlCommand[] _commandCollection;
		private bool _clearBeforeFill;
		[System.Diagnostics.DebuggerNonUserCode]
		private SqlDataAdapter Adapter
		{
			get
			{
				if (this._adapter == null)
				{
					this.InitAdapter();
				}
				return this._adapter;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		internal SqlConnection Connection
		{
			get
			{
				if (this._connection == null)
				{
					this.InitConnection();
				}
				return this._connection;
			}
			set
			{
				this._connection = value;
				if (this.Adapter.InsertCommand != null)
				{
					this.Adapter.InsertCommand.Connection = value;
				}
				if (this.Adapter.DeleteCommand != null)
				{
					this.Adapter.DeleteCommand.Connection = value;
				}
				if (this.Adapter.UpdateCommand != null)
				{
					this.Adapter.UpdateCommand.Connection = value;
				}
				for (int i = 0; i < this.CommandCollection.Length; i++)
				{
					if (this.CommandCollection[i] != null)
					{
						this.CommandCollection[i].Connection = value;
					}
				}
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		protected SqlCommand[] CommandCollection
		{
			get
			{
				if (this._commandCollection == null)
				{
					this.InitCommandCollection();
				}
				return this._commandCollection;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		public bool ClearBeforeFill
		{
			get
			{
				return this._clearBeforeFill;
			}
			set
			{
				this._clearBeforeFill = value;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		public HL_GroupTableAdapter()
		{
			this.ClearBeforeFill = true;
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitAdapter()
		{
			this._adapter = new SqlDataAdapter();
			DataTableMapping dataTableMapping = new DataTableMapping();
			dataTableMapping.SourceTable = "Table";
			dataTableMapping.DataSetTable = "HL_Group";
			dataTableMapping.ColumnMappings.Add("GroupID", "GroupID");
			dataTableMapping.ColumnMappings.Add("GroupName", "GroupName");
			dataTableMapping.ColumnMappings.Add("GroupIntro", "GroupIntro");
			dataTableMapping.ColumnMappings.Add("SendMessage", "SendMessage");
			dataTableMapping.ColumnMappings.Add("MaxMessage", "MaxMessage");
			dataTableMapping.ColumnMappings.Add("AllowUploadSize", "AllowUploadSize");
			dataTableMapping.ColumnMappings.Add("ShoppingDiscount", "ShoppingDiscount");
			dataTableMapping.ColumnMappings.Add("OverDraft", "OverDraft");
			dataTableMapping.ColumnMappings.Add("ReCharge", "ReCharge");
			dataTableMapping.ColumnMappings.Add("Transfer", "Transfer");
			dataTableMapping.ColumnMappings.Add("TransferCharge", "TransferCharge");
			dataTableMapping.ColumnMappings.Add("AllowAnswerLibrary", "AllowAnswerLibrary");
			dataTableMapping.ColumnMappings.Add("AllowReadLibrary", "AllowReadLibrary");
			dataTableMapping.ColumnMappings.Add("AllowQuestion", "AllowQuestion");
			dataTableMapping.ColumnMappings.Add("AllowSycharArticle", "AllowSycharArticle");
			dataTableMapping.ColumnMappings.Add("AllowRss", "AllowRss");
			dataTableMapping.ColumnMappings.Add("GroupMemberNum", "GroupMemberNum");
			dataTableMapping.ColumnMappings.Add("GroupType", "GroupType");
			this._adapter.TableMappings.Add(dataTableMapping);
			this._adapter.DeleteCommand = new SqlCommand();
			this._adapter.DeleteCommand.Connection = this.Connection;
			this._adapter.DeleteCommand.CommandText = "DELETE FROM [HL_Group] WHERE (([GroupID] = @Original_GroupID))";
			this._adapter.DeleteCommand.CommandType = CommandType.Text;
			this._adapter.DeleteCommand.Parameters.Add(new SqlParameter("@Original_GroupID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "GroupID", DataRowVersion.Original, false, null, "", "", ""));
			this._adapter.InsertCommand = new SqlCommand();
			this._adapter.InsertCommand.Connection = this.Connection;
			this._adapter.InsertCommand.CommandText = "INSERT INTO [HL_Group] ([GroupName], [GroupIntro], [GroupType], [SendMessage], [MaxMessage], [AllowUploadSize], [ShoppingDiscount], [OverDraft], [ReCharge], [Transfer], [TransferCharge], [AllowAnswerLibrary], [AllowReadLibrary], [AllowQuestion], [AllowSycharArticle], [AllowRss], [GroupMemberNum]) VALUES (@GroupName, @GroupIntro, @GroupType, @SendMessage, @MaxMessage, @AllowUploadSize, @ShoppingDiscount, @OverDraft, @ReCharge, @Transfer, @TransferCharge, @AllowAnswerLibrary, @AllowReadLibrary, @AllowQuestion, @AllowSycharArticle, @AllowRss, @GroupMemberNum)";
			this._adapter.InsertCommand.CommandType = CommandType.Text;
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@GroupName", SqlDbType.NVarChar, 0, ParameterDirection.Input, 0, 0, "GroupName", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@GroupIntro", SqlDbType.Text, 0, ParameterDirection.Input, 0, 0, "GroupIntro", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@GroupType", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "GroupType", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@SendMessage", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "SendMessage", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@MaxMessage", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "MaxMessage", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@AllowUploadSize", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "AllowUploadSize", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ShoppingDiscount", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "ShoppingDiscount", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@OverDraft", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "OverDraft", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ReCharge", SqlDbType.Bit, 0, ParameterDirection.Input, 0, 0, "ReCharge", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Transfer", SqlDbType.Bit, 0, ParameterDirection.Input, 0, 0, "Transfer", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@TransferCharge", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "TransferCharge", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@AllowAnswerLibrary", SqlDbType.Bit, 0, ParameterDirection.Input, 0, 0, "AllowAnswerLibrary", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@AllowReadLibrary", SqlDbType.Bit, 0, ParameterDirection.Input, 0, 0, "AllowReadLibrary", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@AllowQuestion", SqlDbType.Bit, 0, ParameterDirection.Input, 0, 0, "AllowQuestion", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@AllowSycharArticle", SqlDbType.NVarChar, 0, ParameterDirection.Input, 0, 0, "AllowSycharArticle", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@AllowRss", SqlDbType.Bit, 0, ParameterDirection.Input, 0, 0, "AllowRss", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@GroupMemberNum", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "GroupMemberNum", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand = new SqlCommand();
			this._adapter.UpdateCommand.Connection = this.Connection;
			this._adapter.UpdateCommand.CommandText = "UPDATE [HL_Group] SET [GroupName] = @GroupName, [GroupIntro] = @GroupIntro, [GroupType] = @GroupType, [SendMessage] = @SendMessage, [MaxMessage] = @MaxMessage, [AllowUploadSize] = @AllowUploadSize, [ShoppingDiscount] = @ShoppingDiscount, [OverDraft] = @OverDraft, [ReCharge] = @ReCharge, [Transfer] = @Transfer, [TransferCharge] = @TransferCharge, [AllowAnswerLibrary] = @AllowAnswerLibrary, [AllowReadLibrary] = @AllowReadLibrary, [AllowQuestion] = @AllowQuestion, [AllowSycharArticle] = @AllowSycharArticle, [AllowRss] = @AllowRss, [GroupMemberNum] = @GroupMemberNum WHERE (([GroupID] = @Original_GroupID))";
			this._adapter.UpdateCommand.CommandType = CommandType.Text;
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@GroupName", SqlDbType.NVarChar, 0, ParameterDirection.Input, 0, 0, "GroupName", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@GroupIntro", SqlDbType.Text, 0, ParameterDirection.Input, 0, 0, "GroupIntro", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@GroupType", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "GroupType", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@SendMessage", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "SendMessage", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@MaxMessage", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "MaxMessage", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@AllowUploadSize", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "AllowUploadSize", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ShoppingDiscount", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "ShoppingDiscount", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@OverDraft", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "OverDraft", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ReCharge", SqlDbType.Bit, 0, ParameterDirection.Input, 0, 0, "ReCharge", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Transfer", SqlDbType.Bit, 0, ParameterDirection.Input, 0, 0, "Transfer", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@TransferCharge", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "TransferCharge", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@AllowAnswerLibrary", SqlDbType.Bit, 0, ParameterDirection.Input, 0, 0, "AllowAnswerLibrary", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@AllowReadLibrary", SqlDbType.Bit, 0, ParameterDirection.Input, 0, 0, "AllowReadLibrary", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@AllowQuestion", SqlDbType.Bit, 0, ParameterDirection.Input, 0, 0, "AllowQuestion", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@AllowSycharArticle", SqlDbType.NVarChar, 0, ParameterDirection.Input, 0, 0, "AllowSycharArticle", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@AllowRss", SqlDbType.Bit, 0, ParameterDirection.Input, 0, 0, "AllowRss", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@GroupMemberNum", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "GroupMemberNum", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Original_GroupID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "GroupID", DataRowVersion.Original, false, null, "", "", ""));
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitConnection()
		{
			this._connection = new SqlConnection();
			this._connection.ConnectionString = Conn.CurrenConnectionStrings;
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitCommandCollection()
		{
			this._commandCollection = new SqlCommand[3];
			this._commandCollection[0] = new SqlCommand();
			this._commandCollection[0].Connection = this.Connection;
			this._commandCollection[0].CommandText = "SELECT GroupID, GroupName, GroupIntro,GroupType, SendMessage, MaxMessage, AllowUploadSize, ShoppingDiscount, OverDraft, ReCharge, Transfer, TransferCharge, AllowAnswerLibrary, AllowReadLibrary, AllowQuestion, AllowSycharArticle, AllowRss, GroupMemberNum\r\nFROM \r\nHL_Group";
			this._commandCollection[0].CommandType = CommandType.Text;
			this._commandCollection[1] = new SqlCommand();
			this._commandCollection[1].Connection = this.Connection;
			this._commandCollection[1].CommandText = "pr_DeleteGroup";
			this._commandCollection[1].CommandType = CommandType.StoredProcedure;
			this._commandCollection[1].Parameters.Add(new SqlParameter("@RETURN_VALUE", SqlDbType.Int, 4, ParameterDirection.ReturnValue, 10, 0, null, DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[1].Parameters.Add(new SqlParameter("@GroupID", SqlDbType.Int, 4, ParameterDirection.Input, 10, 0, null, DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[2] = new SqlCommand();
			this._commandCollection[2].Connection = this.Connection;
			this._commandCollection[2].CommandText = "SELECT AllowAnswerLibrary, AllowQuestion, AllowReadLibrary, AllowRss, AllowSycharArticle, AllowUploadSize, GroupID, GroupIntro, GroupMemberNum, GroupName, GroupType, MaxMessage, OverDraft, ReCharge, SendMessage, ShoppingDiscount, Transfer, TransferCharge FROM HL_Group WHERE (GroupID = @GroupID)";
			this._commandCollection[2].CommandType = CommandType.Text;
			this._commandCollection[2].Parameters.Add(new SqlParameter("@GroupID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "GroupID", DataRowVersion.Current, false, null, "", "", ""));
		}
		[DataObjectMethod(DataObjectMethodType.Select, true), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual H_Group.HL_GroupDataTable GetGroups()
		{
			this.Adapter.SelectCommand = this.CommandCollection[0];
			H_Group.HL_GroupDataTable hL_GroupDataTable = new H_Group.HL_GroupDataTable();
			this.Adapter.Fill(hL_GroupDataTable);
			return hL_GroupDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual H_Group.HL_GroupDataTable GetGroupByGroupID(int GroupID)
		{
			this.Adapter.SelectCommand = this.CommandCollection[2];
			this.Adapter.SelectCommand.Parameters[0].Value = GroupID;
			H_Group.HL_GroupDataTable hL_GroupDataTable = new H_Group.HL_GroupDataTable();
			this.Adapter.Fill(hL_GroupDataTable);
			return hL_GroupDataTable;
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(H_Group.HL_GroupDataTable dataTable)
		{
			return this.Adapter.Update(dataTable);
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(H_Group dataSet)
		{
			return this.Adapter.Update(dataSet, "HL_Group");
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(DataRow dataRow)
		{
			return this.Adapter.Update(new DataRow[]
			{
				dataRow
			});
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(DataRow[] dataRows)
		{
			return this.Adapter.Update(dataRows);
		}
		[DataObjectMethod(DataObjectMethodType.Delete, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int DeleteGroup(int? GroupID)
		{
			SqlCommand sqlCommand = this.CommandCollection[1];
			if (GroupID.HasValue)
			{
				sqlCommand.Parameters[1].Value = GroupID.Value;
			}
			else
			{
				sqlCommand.Parameters[1].Value = System.DBNull.Value;
			}
			ConnectionState state = sqlCommand.Connection.State;
			if ((sqlCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
			{
				sqlCommand.Connection.Open();
			}
			int result;
			try
			{
				result = sqlCommand.ExecuteNonQuery();
			}
			finally
			{
				if (state == ConnectionState.Closed)
				{
					sqlCommand.Connection.Close();
				}
			}
			return result;
		}
	}
}
